home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio
/
Ham Radio CD-ROM (Emerald Software) (1995).ISO
/
maps
/
worldtim
/
worldtim.bas
next >
Wrap
BASIC Source File
|
1985-08-25
|
10KB
|
324 lines
10 REM ************************* WORLDTIM.BAS *********************************
20 REM WORLD TIME TABLE PROGRAM
30 REM BY GORDON BEST
40 REM MAY 1985
50 REM ************************************************************************
60 DIM CITY$(100)
70 DIM AH(100)
80 DIM AM(100)
90 DIM ADST$(100)
100 DIM RR(100)
110 DIM CC(100)
120 DEF FNUP$(A$)=CHR$((ASC(A$)+(32*(ASC(A$)>96))))
130 KEY OFF
140 FT$=""
150 COLOR 0,1
160 CLS
170 OPEN "WORLDTIM.DAT" FOR INPUT AS #1
180 LINE INPUT #1,X$
190 X$=X$+",S,N,"
200 C=INSTR(X$,",") : LOCNAM$=LEFT$(X$,C-1) : X$=MID$(X$,C+1)
210 C=INSTR(X$,",") : LOCDST$=LEFT$(X$,C-1) : X$=MID$(X$,C+1)
220 C=INSTR(X$,",") : DSTADJ=VAL(LEFT$(X$,C-1)): X$=MID$(X$,C+1)
230 C=INSTR(X$,",") : NYCADJ=VAL(LEFT$(X$,C-1)): X$=MID$(X$,C+1)
240 C=INSTR(X$,",") : DST$=LEFT$(X$,C-1) : X$=MID$(X$,C+1)
250 C=INSTR(X$,",") : MILT$=LEFT$(X$,C-1) : X$=MID$(X$,C+1)
260 C=INSTR(X$,",") : SQZ$=LEFT$(X$,C-1) : X$=MID$(X$,C+1)
270 FOR I=1 TO 100
280 IF EOF(1) GOTO 310
290 INPUT #1,CITY$(I),AH(I),AM(I),ADST$(I),RR(I),CC(I)
300 NEXT I
310 CLOSE 1
320 NC=I-1
330 PREVMIN=-1
340 'MAIN LOOP
350 COLOR 0,1
360 CLS
370 IF FT$="" THEN TT$=TIME$ ELSE TT$=FT$
380 COLOR 14,4
390 LOCATE 1,1:PRINT DATE$;
400 HDR$="** WORLD TIME FROM "+LOCNAM$+" **" : HP=INT((80-LEN(HDR$))/2)
410 LOCATE 1,HP:PRINT HDR$
420 IF FT$<>"" THEN LOCATE 1,60 : PRINT "*FREEZE*";
430 LOCATE 1,69:PRINT TT$;
440 IF DST$="Y" THEN COLOR 0,2 ELSE COLOR 10,0
450 LOCATE 1,78 : IF DST$="Y" THEN PRINT "DST" ELSE PRINT "STD";
460 H=VAL(LEFT$(TT$,2))
470 M=VAL(MID$(TT$,4,2))
480 FOR I=1 TO NC
490 IF FT$="" THEN TT$=TIME$ ELSE TT$=FT$
500 H=VAL(LEFT$(TT$,2))
510 M=VAL(MID$(TT$,4,2))
520 IF SQZ$="Y" THEN BLNK$="" ELSE BLNK$=" "
530 IF DST$="Y" AND ADST$(I)="Y" THEN COLOR 0,2 ELSE COLOR 10,0
540 CH=H+AH(I)-NYCADJ
550 IF DST$="N" THEN GOTO 580
560 IF ADST$(I)=LOCDST$ THEN GOTO 580
570 IF LOCDST$="Y" THEN CH=CH-DSTADJ ELSE CH=CH+DSTADJ
580 CM=M+AM(I)
590 IF CM>60 THEN CH=CH+1 : CM=CM-60
600 IF CM<0 THEN CH=CH-1 : CM=CM+60
610 CD$=""
620 IF CH>23 THEN CD$=BLNK$+"+1" : CH=CH-24
630 IF CH<0 THEN CD$=BLNK$+"-1" : CH=CH+24
640 IF MILT$="M" THEN AP$="" : GOTO 680
650 AP$="am"
660 IF CH>12 THEN CH=CH-12 : AP$="pm"
670 IF CH=0 THEN CH=12
680 CT$=" "+MID$(STR$(CH),2)+":"+RIGHT$(STR$(CM),2)+AP$+CD$
690 IF MID$(CT$,3,1)=" " THEN MID$(CT$,3,1)="0"
700 IF MID$(CT$,4,1)=" " THEN MID$(CT$,4,1)="0"
710 IF MID$(CT$,5,1)=" " THEN MID$(CT$,5,1)="0"
720 D$=BLNK$+CITY$(I)+CT$+BLNK$
730 D=LEN(D$)
740 DR=RR(I) : DC=CC(I)
750 IF DR<3 THEN DR=3
760 IF DR >23 THEN DR=23
770 IF DC<1 THEN DC=1
780 IF DC>81-D THEN DC=81-D
790 LOCATE DR,DC : PRINT D$;
800 IF FT$="" THEN COLOR 14,4 : LOCATE 1,69 : PRINT TT$
810 NEXT I
820 COLOR 0,3
830 LOCATE 25,2:PRINT "<< F=FREEZE TIME A=ADD CITY C=CHANGE E=ERASE X=EXIT S=SETUP >>";
840 A$=""
850 A$=INKEY$
860 IF A$="" THEN GOTO 370
870 PREVMIN=-1
880 A$=FNUP$(A$)
890 IF A$="F" THEN GOTO 970
900 IF A$="S" THEN GOTO 1080
910 IF A$="A" THEN GOTO 1620
920 IF A$="C" THEN GOTO 1860
930 IF A$="E" THEN GOTO 2390
940 IF A$="X" THEN COLOR 15,1:CLS: SYSTEM
950 IF A$="Z" THEN COLOR 15,1:CLS: END
960 BEEP : GOTO 840
970 'FREEZE TIME
980 CLS
990 LOCATE 10,30 : PRINT "*** FREEZE TIME ***"
1000 LOCATE 22,20 : PRINT "HIT <ENTER> TO RESET TO SYSTEM TIME"
1010 LOCATE 15,20 : INPUT "TIME TO FREEZE (HH:MM)";FT$
1020 CLS
1030 IF FT$="" THEN GOTO 340
1040 IF LEN(FT$)<>5 THEN BEEP : GOTO 980
1050 IF MID$(FT$,3,1)<>":" THEN BEEP :GOTO 980
1060 FT$=FT$+":00"
1070 GOTO 340
1080 'SETUP
1090 CLS
1100 LOCATE 3,20 : PRINT "** SETUP **"
1110 LOCATE 6,20 : PRINT "1 > BASE LOCATION : ";LOCNAM$;
1120 LOCATE 8,20 : PRINT "2 > LOCAL DST (Y/N) : ";LOCDST$;
1130 LOCATE 10,20 : PRINT "3 > DST ADJ FACTOR :";DSTADJ;
1140 LOCATE 12,20 : PRINT "4 > NYC ADJ FACTOR :";NYCADJ;
1150 LOCATE 14,20 : PRINT "5 > DST IN EFFECT (Y/N) : ";DST$;
1160 LOCATE 16,20 : PRINT "6 > (S)TD OR (M)ILITARY : ";MILT$;
1170 LOCATE 18,20 : PRINT "7 > SQUEEZE DISPLAY (Y/N) : ";SQZ$;
1180 LOCATE 21,20 : PRINT "0 > END SETUP"
1190 CL=24 : GOSUB 3160
1200 LOCATE 24,10 : PRINT "WHAT DO YOU WANT TO CHANGE ";:A$=INPUT$(1)
1210 IF A$="0" THEN GOSUB 3010 : CLS : GOTO 340
1220 IF A$="1" THEN GOTO 1300
1230 IF A$="2" THEN GOTO 1340
1240 IF A$="3" THEN GOTO 1390
1250 IF A$="4" THEN GOTO 1430
1260 IF A$="5" THEN GOTO 1470
1270 IF A$="6" THEN GOTO 1520
1280 IF A$="7" THEN GOTO 1570
1290 BEEP : GOTO 1190
1300 'CHANGE BASE LOCATION
1310 CL=24 : GOSUB 3160
1320 LOCATE 24,20 : INPUT "BASE LOCATION : ",LOCNAM$
1330 GOTO 1090
1340 'CHANGE LOCAL DST
1350 CL=24 : GOSUB 3160
1360 LOCATE 24,20 : INPUT "LOCAL DST (Y/N) : ",LOCDST$
1370 LOCDST$=FNUP$(LOCDST$)
1380 GOTO 1090
1390 'CHANGE DST ADJ FACTOR
1400 CL=24 : GOSUB 3160
1410 LOCATE 24,20 : INPUT "DST ADJ FACTOR : ",DSTADJ
1420 GOTO 1090
1430 'CHANGE NYC ADJ FACTOR
1440 CL=24 : GOSUB 3160
1450 LOCATE 24,20 : INPUT "NYC ADJ FACTOR : ",NYCADJ
1460 GOTO 1090
1470 'CHANGE DST FLAG
1480 CL=24 : GOSUB 3160
1490 LOCATE 24,20 : INPUT "DST IN EFFECT (Y/N) : ",DST$
1500 DST$=FNUP$(DST$)
1510 GOTO 1090
1520 'CHANGE STD/MILT TIME DISPLAY
1530 CL=24 : GOSUB 3160
1540 LOCATE 24,20 : INPUT "(S)TD OR (M)ILITARY : ",MILT$
1550 MILT$=FNUP$(MILT$)
1560 GOTO 1090
1570 'CHANGE SQUEEZE Y/N
1580 CL=24 : GOSUB 3160
1590 LOCATE 24,20 : INPUT "SQUEEZE DISPLAY (Y/N) : ",SQZ$
1600 SQZ$=FNUP$(SQZ$)
1610 GOTO 1090
1620 'ADD
1630 CLS
1640 LOCATE 3,20 : PRINT "** ADD **"
1650 GOSUB 2650
1660 IF A$="" THEN GOTO 340
1670 GOSUB 2710
1680 IF A$="" THEN GOTO 1650
1690 GOSUB 2770
1700 IF A$="" THEN GOTO 1670
1710 GOSUB 2830
1720 IF A$="" THEN GOTO 1690
1730 GOSUB 2890
1740 IF A$="" THEN GOTO 1710
1750 GOSUB 2950
1760 IF A$="" THEN GOTO 1730
1770 NC=NC+1
1780 CITY$(NC)=CT$
1790 AH(NC)=HH
1800 AM(NC)=MM
1810 ADST$(NC)=AD$
1820 RR(NC)=IRR
1830 CC(NC)=ICC
1840 GOSUB 3010
1850 GOTO 1620
1860 ' CHANGE CITY
1870 CLS
1880 LOCATE 3,20 : PRINT "** CHANGE **"
1890 GOSUB 2650
1900 IF A$="" THEN GOTO 340
1910 GOSUB 3100
1920 IF REC=0 THEN BEEP : GOTO 1860
1930 FOR CL=10 TO 20 STEP 2 : GOSUB 3160 : NEXT
1940 LOCATE 10,20 : PRINT "(H)OURS DIFF :";AH(REC)
1950 LOCATE 12,20 : PRINT "(M)INUTES DIFF :";AM(REC)
1960 LOCATE 14,20 : PRINT "(A)DJ DST <Y/N> : ";ADST$(REC)
1970 LOCATE 16,20 : PRINT "DISPLAY (R)OW :";RR(REC)
1980 LOCATE 18,20 : PRINT "DISPLAY (C)OL :";CC(REC)
1990 LOCATE 20,20 : PRINT "(E)ND CHANGES"
2000 LOCATE 23,10 : PRINT "WHAT TO CHANGE (H M A R C E)":C$=INPUT$(1)
2010 C$=FNUP$(C$)
2020 IF C$="H" THEN GOTO 2110
2030 IF C$="M" THEN GOTO 2160
2040 IF C$="A" THEN GOTO 2210
2050 IF C$="R" THEN GOTO 2260
2060 IF C$="C" THEN GOTO 2310
2070 IF C$=" " THEN GOTO 2360
2080 IF C$="E" THEN GOTO 2360
2090 IF C$="Q" THEN GOTO 2360
2100 BEEP : GOTO 2000
2110 'HOURS
2120 GOSUB 2710
2130 IF A$="" THEN GOTO 1930
2140 AH(REC)=VAL(A$)
2150 GOTO 1930
2160 'MINUTES
2170 GOSUB 2770
2180 IF A$="" THEN GOTO 1930
2190 AM(REC)=VAL(A$)
2200 GOTO 1930
2210 'ADJ DST
2220 GOSUB 2830
2230 IF A$="" THEN GOTO 1930
2240 ADST$(REC)=FNUP$(A$)
2250 GOTO 1930
2260 'ROW
2270 GOSUB 2890
2280 IF A$="" THEN GOTO 1930
2290 RR(REC)=VAL(A$)
2300 GOTO 1930
2310 'COL
2320 GOSUB 2950
2330 IF A$="" THEN GOTO 1930
2340 CC(REC)=VAL(A$)
2350 GOTO 1930
2360 'ALL DONE
2370 GOSUB 3010
2380 GOTO 1860
2390 ' ERASE CITY
2400 CLS
2410 LOCATE 3,20 : PRINT "** ERASE **"
2420 GOSUB 2650
2430 IF A$="" THEN GOTO 340
2440 GOSUB 3100
2450 IF REC=0 THEN BEEP : GOTO 1860
2460 FOR CL=12 TO 20 STEP 2 : GOSUB 3160 : NEXT
2470 LOCATE 12,20 : PRINT "HOURS DIFF : ";AH(REC)
2480 LOCATE 14,20 : PRINT "MINUTES DIFF : ";AM(REC)
2490 LOCATE 16,20 : PRINT "ADJ DST (Y/N) : ";ADST$(REC)
2500 LOCATE 18,20 : PRINT "DISPLAY ROW :";RR(REC)
2510 LOCATE 20,20 : PRINT "DISPLAY COL :";CC(REC)
2520 CL=23 : GOSUB 3160
2530 LOCATE 23,10 : PRINT "OK TO ERASE ":C$=INPUT$(1)
2540 C$=FNUP$(C$)
2550 IF C$<>"Y" THEN GOTO 2390
2560 CITY$(REC)=CITY$(NC)
2570 AH(REC)=AH(NC)
2580 AM(REC)=AM(NC)
2590 ADST$(REC)=ADST$(NC)
2600 RR(REC)=RR(NC)
2610 CC(REC)=CC(NC)
2620 NC=NC-1
2630 GOSUB 3010
2640 GOTO 2390
2650 'ASK CITY
2660 CL=10 : GOSUB 3160
2670 LOCATE 8,20 : PRINT "CITY : "; : INPUT " >> ",A$
2680 IF A$="" THEN RETURN
2690 CT$=A$
2700 RETURN
2710 ' ASK HOURS
2720 CL=12 : GOSUB 3160
2730 LOCATE 12,20 : PRINT "HOURS DIFF : "; : INPUT " >> ",A$
2740 IF A$="" THEN RETURN
2750 HH=VAL(A$)
2760 RETURN
2770 ' ASK MINS
2780 CL=14 : GOSUB 3160
2790 LOCATE 14,20 : PRINT "MINUTES DIFF : "; : INPUT " >> ",A$
2800 IF A$="" THEN RETURN
2810 MM=VAL(A$)
2820 RETURN
2830 ' ASK DST
2840 CL=16 : GOSUB 3160
2850 LOCATE 16,20 : PRINT "ADJ DST (Y/N) : "; : INPUT " >> ",A$
2860 IF A$="" THEN RETURN
2870 AD$=FNUP$(A$)
2880 RETURN
2890 ' ASK ROW
2900 CL=18 : GOSUB 3160
2910 LOCATE 18,20 : PRINT "DISPLAY ROW :"; : INPUT " >> ",A$
2920 IF A$="" THEN RETURN
2930 IRR=VAL(A$)
2940 RETURN
2950 ' ASK COL
2960 CL=20 : GOSUB 3160
2970 LOCATE 20,20 : PRINT "DISPLAY COL :"; : INPUT " >> ",A$
2980 IF A$="" THEN RETURN
2990 ICC=VAL(A$)
3000 RETURN
3010 'REWRITE FILE
3020 CLS : LOCATE 10,25 : PRINT "*** ONE MOMENT PLEASE ***"
3030 OPEN "WORLDTIM.DAT" FOR OUTPUT AS #1
3040 PRINT #1,LOCNAM$;",";LOCDST$;",";DSTADJ;",";NYCADJ;",";DST$;",";MILT$;",";SQZ$
3050 FOR I=1 TO NC
3060 PRINT #1,CITY$(I);",";AH(I);",";AM(I);",";ADST$(I);",";RR(I);",";CC(I)
3070 NEXT I
3080 CLOSE 1
3090 RETURN
3100 'FIND CITY
3110 REC=0
3120 FOR I=1 TO NC
3130 IF CITY$(I)=A$ THEN REC=I : RETURN
3140 NEXT I
3150 RETURN
3160 'CLEAR LINE
3170 LOCATE CL,1 :PRINT SPACE$(79);
3180 RETURN
3190 REM FORCE CAPS LOCK ON / ALL OTHERS OFF
3200 DEF SEG = &H40
3210 POKE &H17,64
3220 DEF SEG
3230 RETURN